Skip to content

Conversation

@shoom3301
Copy link
Contributor

@shoom3301 shoom3301 commented Nov 13, 2025

Summary by CodeRabbit

  • Refactor
    • Improved code maintainability by streamlining adapter configuration definitions for AAVE flash loan functionality.

Refactor AAVE adapter factory and hooks to use mapAddressToSupportedNetworks for initialization.
@shoom3301 shoom3301 requested a review from a team November 13, 2025 14:56
@shoom3301 shoom3301 self-assigned this Nov 13, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

Walkthrough

The AAVE adapter factory and hook address constants in the flash-loans package are refactored to use direct calls to mapAddressToSupportedNetworks with specific addresses, replacing previous per-network object literals with spread operators.

Changes

Cohort / File(s) Change Summary
AAVE Constants Refactoring
packages/flash-loans/src/aave/const.ts
Four exported constants (AAVE_ADAPTER_FACTORY, AAVE_COLLATERAL_SWAP_ADAPTER_HOOK, AAVE_DEBT_SWAP_ADAPTER_HOOK, AAVE_REPAY_COLLATERAL_ADAPTER_HOOK) simplified from per-network object literals with spreads to single-address mapAddressToSupportedNetworks calls with concrete addresses.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Single file with repetitive, consistent refactoring pattern
  • Four constants changed using the same approach
  • Primary review focus: verify each address is correct and that network mapping behavior remains identical

Possibly related PRs

Suggested reviewers

  • carlos-cow
  • alfetopito

Poem

🐰 Four hooks hopped into one neat line,
No spreads or spreads—just addresses so fine!
mapAddressToSupportedNetworks did say,
"One address for all chains, hip-hop-hooray!"

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(flash-loans): update smartcontract addresses' accurately describes the main change: updating Aave adapter and hook contract addresses in the flash-loans package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch shoom3301-patch-2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

📦 GitHub Packages Published

Last updated: Nov 13, 2025, 02:58:31 PM UTC

The following packages have been published to GitHub Packages with pre-release version pr-676-66b53b05:


Installation

These packages require authentication to install from GitHub Packages. First, create a .npmrc file:

# Create .npmrc file in your project root
echo "@cowprotocol:registry=https://npm.pkg.github.com" > .npmrc
echo "//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN" >> .npmrc

To get your GitHub token:

  1. Go to https://github.com/settings/tokens
  2. Click "Generate new token (classic)"
  3. Check only the "read:packages" scope
  4. Copy the token and replace YOUR_GITHUB_TOKEN in the .npmrc file

Then install any of the packages above, either by exact version (i.e. @cowprotocol/[email protected]) or more conveniently by using the tag (@cowprotocol/cow-sdk@pr-676):

# Yarn
yarn add npm:@cowprotocol/cow-sdk@pr-676

# pnpm
pnpm install npm:@cowprotocol/cow-sdk@pr-676

# NPM
npm install npm:@cowprotocol/cow-sdk@pr-676

Update to the latest version (only if you used the tag)

Every commit will publish a new package. To upgrade to the latest version, run:

# Yarn
yarn upgrade @cowprotocol/cow-sdk

# pnpm
pnpm update @cowprotocol/cow-sdk

# NPM
npm update @cowprotocol/cow-sdk

View Packages

You can view the published packages at: https://github.com/cowprotocol/cow-sdk/packages

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b04b9e and c351a75.

📒 Files selected for processing (1)
  • packages/flash-loans/src/aave/const.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: alfetopito
Repo: cowprotocol/cow-sdk PR: 391
File: src/trading/getEthFlowTransaction.ts:80-85
Timestamp: 2025-08-12T09:15:28.459Z
Learning: In the CoW SDK codebase, ETH_FLOW_ADDRESSES and BARN_ETH_FLOW_ADDRESSES are typed as Record<SupportedChainId, string>, which requires all SupportedChainId enum values to have corresponding string entries. TypeScript compilation will fail if any chainId is missing from these mappings, making runtime guards for missing addresses unnecessary in these specific cases.
📚 Learning: 2025-08-12T09:15:28.459Z
Learnt from: alfetopito
Repo: cowprotocol/cow-sdk PR: 391
File: src/trading/getEthFlowTransaction.ts:80-85
Timestamp: 2025-08-12T09:15:28.459Z
Learning: In the CoW SDK codebase, ETH_FLOW_ADDRESSES and BARN_ETH_FLOW_ADDRESSES are typed as Record<SupportedChainId, string>, which requires all SupportedChainId enum values to have corresponding string entries. TypeScript compilation will fail if any chainId is missing from these mappings, making runtime guards for missing addresses unnecessary in these specific cases.

Applied to files:

  • packages/flash-loans/src/aave/const.ts
🧬 Code graph analysis (1)
packages/flash-loans/src/aave/const.ts (1)
packages/config/src/chains/const/utils.ts (1)
  • mapAddressToSupportedNetworks (16-18)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: test
  • GitHub Check: eslint
  • GitHub Check: Build Package
  • GitHub Check: Publish to GitHub Packages
🔇 Additional comments (1)
packages/flash-loans/src/aave/const.ts (1)

30-38: Hook addresses verified as deployed across major networks.

The three hook adapters are correctly configured with single addresses across all chains. Verification confirms all three hooks have bytecode deployed on Ethereum Mainnet, Gnosis Chain, Arbitrum One, and Base:

  • Collateral Swap: 0x29A9b0a13c81d59f13BA0f39DBDCAA1AB2adc95F
  • Debt Swap: 0xbE9A121bb958BBBb027dA728DEC0D5496811b7d1
  • Repay Collateral: 0x8e25d1210FabB0fcAdE92a82C4a89568B4b10E0F

@shoom3301 shoom3301 merged commit 3d78116 into main Nov 13, 2025
9 checks passed
@shoom3301 shoom3301 deleted the shoom3301-patch-2 branch November 13, 2025 15:02
@github-actions github-actions bot locked and limited conversation to collaborators Nov 13, 2025
Copy link
Contributor

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants